#pragma once

//Define the debug break using the MS specific or general using assembly interrupt 3
#ifdef _MSC_VER
#define G_DEBUG_BREAK __debugbreak()
#else
#define G_DEBUG_BREAK do { __asm int 3 } while(0)
#endif

// basic error handler -- see Main.cpp
bool SignalErrorHandler(const char * expression, const char * file,int line, const char * formatMessage = 0, ...);

// The do/while blocks embedded here are ABSOLUTELY NECESSARY to prevent
// bizzare compilation errors. 
// Check out http://cnicholson.net/2009/02/stupid-c-tricks-adventures-in-assert/
// for more details.
#ifdef _DEBUG
#define ErrorIf(exp, ...) \
	do { if( (exp) && SignalErrorHandler(#exp, __FILE__, __LINE__,__VA_ARGS__ )) \
	G_DEBUG_BREAK; } while(0)
#else
#define ErrorIf(...)((void)0)
#endif
